package _base0to1;

/**
 * 1603. 设计停车系统
 */
public class No1603 {
    private int big;
    private int medium;
    private int small;

    public No1603(int big, int medium, int small) {
        this.big = big;
        this.medium = medium;
        this.small = small;
    }

    public boolean addCar(int carType) {
        return switch (carType) {
            case 1 -> {
                if (this.big > 0) {
                    this.big--;
                    yield true;
                } else yield false;
            }
            case 2 -> {
                if (this.medium > 0) {
                    this.medium--;
                    yield true;
                } else yield false;
            }
            case 3 -> {
                if (this.small > 0) {
                    this.small--;
                    yield true;
                } else yield false;
            }
            default -> throw new IllegalStateException("Unexpected value: " + carType);
        };
    }
}
